/** 主入口js */
import Vue from 'vue';
import App from './App.vue';
import store from './store';
import router from './router';
import './config/axios-config';
import permission from './utils/permission';
import './assets/styles/index.scss';
import EleAdmin from 'ele-admin';
import DialogDirective from 'ele-admin/packages/dialog-directive';
import VueClipboard from 'vue-clipboard2';
import i18n from './lang';

Vue.config.productionTip = false;
Vue.use(EleAdmin, {
  size: 'mini',
  i18n: (key, value) => i18n.t(key, value)
});
Vue.use(permission);
Vue.use(DialogDirective);
Vue.use(VueClipboard);

Vue.mixin({
  data() {
    return {
      defaultFormSize: 'mini',
      defaultTableSize: 'mini',
      defaultTableResponse: {
        statusCode: 200,
        dataName: 'result.list',
        countName: 'result.count'
      },
      defaultTableRequest: {
        limitName: 'size'
      }
    }
  },
  methods: {
    // 确认提示框
    confirms(msg, title = '提示', type = 'warning') {
      let _this = this
      return new Promise(function (resolve) {
        _this.$confirm(msg, title, {
          type: type,
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          closeOnClickModal: false,  // 单击遮罩是否可以关闭
          closeOnPressEscape: false, // 按ESC键是否可以关闭
        }).then(() => {
          resolve()
        }).catch(() => {
        })
      })
    },
  }
})

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app');
